package com.slothought.rowgazer;

import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;

// will need to make this singleton I guess
public class DataSourceManager {
    
    private List<DataSource> dataSourceLists;
    
    static DataSource getDataSource(String dataSourceName){
        
        
        DataSourceConfig dataSourceConfig = DataSourceConfig.findAllWhere(['name':dataSourceName])
        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setDriverClassName(dataSourceConfig.dbServerApp.driverClassName)
        dataSource.setUrl(dataSourceConfig.url);
        dataSource.setUsername(dataSourceConfig.username);
        dataSource.setPassword(dataSourceConfig.password);
        
        return dataSource
    }
}
